<%@ page import="Contas.Administrador" %>
<html>
<head>
<title>SPL - Resultados da Consulta</title>
<meta name="layout" content="adminContas" />
</head>
<body>
<div class="list">
	<div align="center"><h1>Administradores</h1></br></div>
                  <table>
                    <thead>     
                       	<tr>
                    		
                            <g:sortableColumn property="userRealName" title="${message(code: 'administrador.userRealName.label', default: 'Nome')}" params ="${params}"/>

                            <g:sortableColumn property="username" title="${message(code: 'administrador.username.label', default: 'Login')}" params ="${params}"/>

                            <g:sortableColumn property="email" title="${message(code: 'administrador.email.label', default: 'Email')}" params ="${params}" />

                            <g:sortableColumn property="telefone" title="${message(code: 'administrador.telefone.label', default: 'Telefone')}" params ="${params}" />
                            
                            <g:sortableColumn property="tipo" title="${message(code: 'administrador.tipo.label', default: 'Tipo')}" params ="${params}" />

                            <g:sortableColumn property="description" title="Detalhes" params ="${params}" />

                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${pesquisaAdmin}" status="i" var="administradorInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">

                        	<td>${fieldValue(bean: administradorInstance, field: "userRealName")}</td>

                            <td>${fieldValue(bean: administradorInstance, field: "username")}</td>

                            <td>${fieldValue(bean: administradorInstance, field: "email")}</td>

                            <td>${fieldValue(bean: administradorInstance, field: "telefone")}</td>
                            
                             <td>${fieldValue(bean: administradorInstance, field: "tipo")}</td>
                            <td class = "actionButtons">
                             <span class = "actionButton">
                            <g:link action="show" id="${administradorInstance.id}">
                              Ver mais
                            </g:link></span></td>
                        </tr>
                    </g:each>
                     </tbody>
                      </table>

                      <div class="paginateButtons">
                        <g:paginate total="${pesquisaAdmin.count()}" />
                      </div>

                      <g:jasperReport action="createReportAdminSimple" controller="administrador" format="PDF" jasper="Relatorio SPL - Administrador Simples" name="Relatorio SPL - PDF"/>
                      <g:jasperReport action="createReportAdminSimple" controller="administrador" format="XLS" jasper="Relatorio SPL - Administrador Simples" name="Relatorio SPL - XLS"/>
                      <g:jasperReport action="createReportAdminSimple" controller="administrador" format="ODT" jasper="Relatorio SPL - Administrador Simples" name="Relatorio SPL - ODT"/>
                      <g:jasperReport action="createReportAdminSimple" controller="administrador" format="DOCX" jasper="Relatorio SPL - Administrador Simples" name="Relatorio SPL - DOCX"/>


                  <div align="center"><h1>Usuarios</h1></br></div>
                    	<table>
                      <thead>
                       <tr>

                            <g:sortableColumn property="userRealName" title="${message(code: 'usuarioComum.userRealName.label', default: 'Nome')}" params ="${params}"/>

                            <g:sortableColumn property="username" title="${message(code: 'usuarioComum.username.label', default: 'Login')}" params ="${params}"/>

                            <g:sortableColumn property="email" title="${message(code: 'usuarioComum.email.label', default: 'Email')}" params ="${params}"/>

                            <g:sortableColumn property="telefone" title="${message(code: 'usuarioComum.telefone.label', default: 'Telefone')}" params ="${params}" />

                            <g:sortableColumn property="projeto" title="${message(code: 'usuarioComum.projeto.label', default: 'Projeto')}" params ="${params}"/>
                            
                            <g:sortableColumn property="tipo" title="${message(code: 'usuarioComum.tipo.label', default: 'Tipo')}" params ="${params}"/>
                            
                            <g:sortableColumn property="anoIngresso" title="${message(code: 'usuarioComum.anoIngresso.label', default: 'Ano de Ingressao')}" params ="${params}"/>

                            <g:sortableColumn property="description" title="Detalhes" params ="${params}"/>

                        </tr>
                    </thead>
                   
                    <tbody>
                    <g:each in="${pesquisaUsuario}" status="i" var="usuarioComumInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">

                            <td>${fieldValue(bean: usuarioComumInstance, field: "userRealName")}</td>

                            <td>${fieldValue(bean: usuarioComumInstance, field: "username")}</td>

                            <td>${fieldValue(bean: usuarioComumInstance, field: "email")}</td>

                            <td>${fieldValue(bean: usuarioComumInstance, field: "telefone")}</td>

                        	<td>${fieldValue(bean: usuarioComumInstance, field: "projeto")}</td>
                        	
                        	<td>${fieldValue(bean: usuarioComumInstance, field: "tipo")}</td>
                        	
                        	<td>${fieldValue(bean: usuarioComumInstance, field: "anoIngresso")}</td>

                             <td class = "actionButtons">
                             <span class = "actionButton">
                            <g:link controller ="usuarioComum" action="show" id="${usuarioComumInstance.id}">
                              Ver mais
                            </g:link></span></td>
                        </tr>
                    </g:each>
                    </tbody>
                </table>
	</div>

        <div class="paginateButtons">
        <g:paginate total="${pesquisaUsuario.count()}" />
        </div>

        <g:jasperReport action="createReportUsuarioSimple" controller="administrador" format="PDF" jasper="Relatorio SPL - Usuario Simples" name="Relatorio SPL - PDF"/>
        <g:jasperReport action="createReportUsuarioSimple" controller="administrador" format="XLS" jasper="Relatorio SPL - Usuario Simples" name="Relatorio SPL - XLS"/>
        <g:jasperReport action="createReportUsuarioSimple" controller="administrador" format="ODT" jasper="Relatorio SPL - Usuario Simples" name="Relatorio SPL - ODT"/>
        <g:jasperReport action="createReportUsuarioSimple" controller="administrador" format="DOCX" jasper="Relatorio SPL - Usuario Simples" name="Relatorio SPL - DOCX"/>


        <div align="center"><br></br><g:link action='search'>Pesquisar Novamente</g:link></div>
</body>
</html>